{include file="public/header" /}
<style>
    .ds-search-form dl{
        margin-right:20px
    }
</style>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>{$Think.lang.ds_Wholesale}</h3>
                <h5></h5>
            </div>
            {include file="public/admin_items" /}
        </div>
    </div>
    <form method="get" name="formSearch" id="formSearch">
        <div class="ds-search-form">

            <dl>
                <dt>{$Think.lang.store_state}</dt>
                <dd>
                    <select name="store_state">
                        <option value="">{$Think.lang.ds_please_choose}...</option>
                        {notempty name="store_state_list"}
                        {foreach name="store_state_list" item="v" key="k" }
                        <option value="{$k}" {$Request.param.store_state == $k ? 'selected' : ''}>{$v}</option>
                        {/foreach}
                        {/notempty}
                    </select>
                </dd>
            </dl>
            <dl>
                <dt>{$Think.lang.ds_store_name}</dt>
                <dd><input type="text" value="{$Request.param.store_name}" name="store_name" id="store_name"
                           class="txt"></dd>
            </dl>

            <dl>
                <dt>{$Think.lang.store_type}</dt>
                <dd>
                    <select name="search_store_type">
                        <option value="">{$Think.lang.ds_please_choose}...</option>
                        {notempty name="store_class_list"}
                        {foreach name="store_class_list" item="v" key="k" }
                        <option value="{$v.storeclass_id}" {if $v.storeclass_id == $class}selected{/if}>{$v.storeclass_name}</option>
                        {/foreach}
                        {/notempty}
                    </select>
                </dd>
            </dl>
            <dl>
                <dt>注册时间</dt>
                <dd>
                  <input type="text" class="txt date" name="query_start_time" id="query_start_time"
                    value="{$Request.param.query_start_time}">
                  &nbsp;–&nbsp;
                  <input id="query_end_time" class="txt date" type="text" name="query_end_time"
                    value="{$Request.param.query_end_time}">
                </dd>
              </dl>
            <dl>
                <dd><input style="height:32px; line-height: 32px;" type="submit" class="btn" value="{$Think.lang.ds_search}"></dd>
                <a style="height:30px; line-height: 30px;" href="{:url('Wholesale/store')}" class="btn btn-default" title="{$Think.lang.ds_cancel}">{$Think.lang.ds_cancel}</a>
                <a style="height:32px; line-height: 32px;" class="btn" href="{:url('Wholesale/ds_add_wholeale')}" class="btn btn-default" >添加供货商</a>
            </dl>
            <div class="btn_group">

            </div>
            <div class="btn_group">

            </div>

          <!--   <a href="{:url('Wholesale/add_wholeale')}"><input type="button" class="btn" value="{$Think.lang.ds_add_wholeale}"></a> -->
        </div>
    </form>

    <table class="ds-default-table">
      <thead>
        <tr class="thead">
<!--            <th class="w48">{$Think.lang.ds_sort}</th>-->
            <th class="w60">{$Think.lang.ds_store_name}</th>
            <th class="w60">{$Think.lang.store_type}</th>
            <th class="w60">{$Think.lang.legal_person}</th>
            <th class="w60">{$Think.lang.register_time}</th>
            <th class="align-center w36">{$Think.lang.state}</th>
            <th class="align-center w36">账期</th>
            <th class="align-center w36">账期额度</th>
            <th class="align-center w36">账期天数</th>
            <th class="align-center w36">余额</th>
            <th class="align-center">{$Think.lang.ds_handle}</th>
        </tr>
      </thead>
      <tbody>
      {notempty name="store_list"}
      {foreach name="store_list" item="v" key="k" }
      <tr class="hover edit {:get_store_state_classname($v)}" id="ds_row_{$v.store_id}">
<!--          <td class="sort"><span class="editable" ds_type="inline_edit" fieldname="store_sort"-->
<!--                                 ajax_branch='store_sort' fieldid="{$v.store_id}" datatype="pint" maxvalue="255"-->
<!--                                 title="{$Think.lang.ds_editable}">{$v.store_sort}</span></td>-->
          <td>
<!--              <a href="{:url('/Home/Store/index',['store_id'=>$v.store_id])}" target="_blank">{$v.store_name}</a>-->
              {$v.store_name}
          </td>
          <td>{$v.storeclass_name}</td>
          <td>{$v.legal_person}</td>
          <td>{:date('Y-m-d H:i:s', $v.store_addtime)}</td>
          <td class="align-center w72">{$v['store_state']?lang('ds_open'):lang('ds_close')}</td>
          <td class="nowarp align-center">{$v.credit_num == 0 ? '未设置' : '已设置'}</td>
          <td class="nowarp align-center">{$v.credit_num}</td>
          <td class="nowarp align-center">{$v.credit_day}</td>
          <td class="nowarp align-center">{$v.balance}</td>

          <td class="align-center w200">
              <a href="javascript:dsLayerOpen('{:url('Wholesale/store_joinin_detail',['member_id'=>$v.member_id])}','{$Think.lang.ds_view}-{$v.store_name}', '100%', '100%')"
                 href="" class="dsui-btn-view"><i class="iconfont"></i>{$Think.lang.ds_view}</a>
              <a href="javascript:dsLayerOpen('{:url('Wholesale/set_credit',['store_id'=>$v.store_id])}','账期设置')" class="dsui-btn-edit"><i class="iconfont"></i>账期设置</a>
              <?php if($v['credit_status']==1){  ?>
              <a style="display: none;" href="javascript:dsLayerConfirm('{:url('Wholesale/cancel_credit',['store_id'=>$v.store_id])}','确认要清空账期设置吗？')" class="dsui-btn-del"><i class="iconfont"></i>清空账期设置</a>
              <?php } ?>
              <a href="{:url('Wholesale/store_edit',['store_id'=>$v.store_id])}" class="dsui-btn-edit"><i
                      class="iconfont"></i>{$Think.lang.ds_edit}</a>
              <a href="{:url('Producty/index',['search_store_id'=>$v.store_id,'type'=>'status_up','search_store_name'=>$v.store_name])}" class="dsui-btn-edit"><i class="iconfont"></i>在售商品</a>
              <?php if (get_store_state_classname($v) != 'open' && cookie('remindRenewal'.$v['store_id']) == null) {?>
              <?php }?>
          </td>
      </tr>
      {/foreach}
      {else /}
      <tr class="no_data">
          <td colspan="15">{$Think.lang.ds_no_record}</td>
      </tr>
      {/notempty}
      </tbody>
    </table>
    {$show_page}
</div>
<script type="text/javascript" src="{$Think.ADMIN_SITE_ROOT}/js/jquery.edit.js" charset="utf-8"></script>
<script type="text/javascript">
    $(function () {
      $('#query_start_time').datepicker({
        dateFormat: 'yy-mm-dd'
      });
      $('#query_end_time').datepicker({
        dateFormat: 'yy-mm-dd'
      });
    });
  

  </script>
